package com.project.service;

import java.util.List;

import com.project.dao.IdeaDao;
import com.project.entity.Idea;
import com.project.util.DateUtil;
import com.project.util.PKUtil;

public class IdeaService {
	IdeaDao id=new IdeaDao();
	
	public List<Idea> findAllIdeaByProjectid(String projectid) {
	
		return id.findAllIdeaByProjectid(projectid);
	}

	public void save(String name, String cont,String projectid,String userid)  {
		Idea idea=new  Idea();
		idea.setCont(cont);
		idea.setCreatetime(DateUtil.getNow());
		idea.setId(PKUtil.getId());
		idea.setName(name);
		idea.setProjectid(projectid);
		idea.setUserid(userid);
		id.save(idea);
	}

	public Idea findIdeaById(String id2) {
		 return id.findIdeaById(id2);
		
	}

	public void update(String id2, String name, String cont) {
		Idea idea=new  Idea();
		idea.setCont(cont);
		idea.setCreatetime(DateUtil.getNow());
		idea.setName(name);
		idea.setId(id2);
		id.update(idea);
		
	}

	public void delIdeaById(String id2) {
		id.delIdeaById(id2);
	}

	

	

	
}
